Java allows overloading of method names. Briefly, this means that
a collection of related methods with different argument signatures can share the same method name,
provided that every method call can be resolved to a unique method declaration based on the context and arguments of the call.
There are complex rules for resolving overloaded calls, and SpotCheck implements these rules
faithfully.
In the example below, the name "aMethod" is overloaded, with one (String,Object) signature and one (Object,String) signature. The first call to "aMethod" is resolved successfully, since it matches only the latter signature. The second call to "aMethod" cannot be resolved, and therefore has an error attached. Since String is a subclass of Object, the call signature of (String,String) matches both declaration signatures. As usual, there are a variety of changes that will remove the error. These include deleting the (String,Object) declaration, or adding a new method with a (String,String) signature. |
© 1997 GenieWorks, LLC. All rights reserved